﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SportsStore.Logging;
using SportsStore.ServicesInterfaces;
using SportsStore.Web.Models.Category;

namespace SportsStore.Web.Controllers
{
  public class NavController : BaseController
  {
    private readonly ICategoryService _categoryService;

    public NavController(ICategoryService categoryService, ILogger logger)
        : base(logger)
    {
      _categoryService = categoryService;
    }

    public ActionResult Menu(string category = null)
    {
      var categoriesViewModel = new CategoriesViewModel();
      var categories = _categoryService.GetCategories();
      categoriesViewModel.AddCategories(categories);
      categoriesViewModel.CurrentCategory = category;
      return PartialView(categoriesViewModel);
    }
  }
}
